package com.carlinfo.common.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.carlinfo.common.util.DateUtil;
import com.carlinfo.common.util.EncryptUtil;
import com.carlinfo.common.util.FileUtil;
import com.carlinfo.common.util.PageInfoUtil;
import com.carlinfo.common.util.RegexUtil;

/**
 * 将servlet封装起来
 * @author LENOVO-CRG
 *
 */
public class BaseServlet extends HttpServlet
{
	protected Logger logger = LogManager.getLogger();
	protected EncryptUtil encryptUtil = new EncryptUtil();
	protected DateUtil dateUtil = new DateUtil();
	protected FileUtil fileUtil = new FileUtil();
	
	/**
	 * 生成随机字符串
	 */
	protected RegexUtil regexUtil = new RegexUtil();
	
	protected PageInfoUtil proccedPageInfo(HttpServletRequest request)
	{
		String currentPage = request.getParameter("currentPage");
		String pageSize = request.getParameter("pageSize");
		PageInfoUtil pageInfoUtil = new PageInfoUtil();
		try
		{
			pageInfoUtil.setCurrentPage(Integer.valueOf(currentPage));
			pageInfoUtil.setPageSize(Integer.valueOf(pageSize));
		}catch (NumberFormatException e)
		{	
		}
		return pageInfoUtil;
	}
	
}
